package com.cyyang.shop.service.impl;

import java.util.List;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.cyyang.shop.bean.Spu;
import com.cyyang.shop.bean.SpuVo;
import com.cyyang.shop.mapper.SpuMapper;
import com.cyyang.shop.service.SpuService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service(timeout = 10000)
public class SpuServiceImpl implements SpuService {

	@Autowired
	SpuMapper spuMapper;
	@Override
	public PageInfo<Spu> list(int pageNum, int pageSize, SpuVo vo) {
		PageHelper.startPage(pageNum, pageSize);
		return new PageInfo<>(spuMapper.list(vo));
	}
	@Override
	public void add(Spu spu) {
		spuMapper.add(spu);
	}
	@Override
	public Spu finSpuBySpuId(Integer spuId) {
		return spuMapper.finSpuBySpuId(spuId);
	}
	@Override
	public void update(Spu spu) {
		spuMapper.update(spu);
	}
	@Override
	public List<Spu> findSpuByCatId(Integer catId) {
		return spuMapper.findSpuByCatId(catId);
	}
	@Override
	public void delSpuById(Integer[] ids) {
		// TODO Auto-generated method stub
		spuMapper.delSpuById(ids);
	}

}
